package stuff;

import java.io.*;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by IntelliJ IDEA.
 * User: 07grishin
 * Date: 07.05.2010
 * Time: 13:13:41
 */
public class Props {
    private HashMap hm = new HashMap();

    public void load(String fname) {
        File file = new File(fname);
        try {
            FileReader fr = new FileReader("x.txt");
            BufferedReader br = new BufferedReader(fr);
            while (true) {
                String s = br.readLine();
                if (s == null) {
                    break;
                }

                Pattern p = Pattern.compile("(.*)\\s*->\\s*(.*)");
                Matcher m = p.matcher(s);
                m.matches();
                //System.out.println(m.group(1));
               // System.out.println(m.group(2));
                hm.put(m.group(1).trim(),m.group(2).trim());
            }

            br.close();

        } catch (Exception e) {
            System.out.println("error: " + e);
        }
    }

    public String get(String key) {
        return (String)hm.get(key);
    }
}
